const Controller = require('egg').Controller;

class SearchController extends Controller {
  async index () {
    const {query} = this.ctx
    const {type, q = "nodejs"} = query
    if (type === "bing") {
      this.ctx.redirect(`http://cn.bing.com/search?q=${q}`)
    } else {
      this.ctx.body = `search q: ${JSON.stringify(this.ctx.query)}}`
    }
    // this.ctx.body = `search: ${this.ctx.query.name}`
  }
}

module.exports = SearchController